import os
import cv2
from PIL import Image

def produceImage(file_in, width, height, file_out):
    image = Image.open(file_in)
    resized_image = image.resize((width, height), Image.ANTIALIAS)
    resized_image.save(file_out)

file_in = {}
file_out={}
txt_folder = './test'
txt_file = os.listdir(txt_folder)
for i in range(len(txt_file)):
    file_in[i]='test/'+txt_file[i]
    file_out[i]= 'test1/'+txt_file[i]
for i in range(len(file_out)):
    img = cv2.imread(file_in[i])
    produceImage(file_in[i],int(256), int(256),file_out[i])